#include <iostream>
#include<string>
#include<cstring>
#include<map>
#include<vector>
#include<algorithm>
using namespace std;
struct Cmp {
    bool operator()(pair<string, int>& e1, pair<string, int>& e2) {
        return e1.second > e2.second ||
               (e1.second == e2.second && e1.first < e2.first);
    }
};
int main() {
    string str;
    map<string, int> m;
    getline(cin, str);
    for (int i = 0, j = 0; j < str.size(); j++) {
        if (str[j] == ' ' || str[j] == '.') {
            string ret = str.substr(i, j - i);
            ret[0]=(char)tolower(ret[0]);
            m[ret]++;
            i = j + 1;
        }
    }
    vector<pair<string, int>> v(m.begin(), m.end());
    sort(v.begin(), v.end(), Cmp());
    for (auto& e : v) {
        cout << e.first << ":" << e.second << endl;
    }
    return 0;
}